#!/bin/bash

echo "Unmounting..."
for i in 0 1; do
	sudo umount -f /dev/loop${i}
done

echo "Removing the directories..."
for i in 0 1; do
	sudo rmdir mnt_dev${i}
done

echo "Removing images..."
for i in 0 1 2; do
	sudo rm -f usb${i}.img
done

echo "Detaching devices..."
for i in 0 1 2; do
	sudo losetup -d /dev/loop${i}
done

echo "zeroing out the devices..."
for i in 0 1 2; do
	sudo mkfs.vfat /dev/loop${i}
done

echo "Done!"
